﻿using System;
using System.Drawing;
using System.Runtime.InteropServices;

namespace SuSPExtension
{
	// Token: 0x02000009 RID: 9
	public class WindowDeviceContext : IDisposable
	{
		// Token: 0x06000012 RID: 18 RVA: 0x00002678 File Offset: 0x00000878
		internal WindowDeviceContext(SystemWindow sw, IntPtr hDC)
		{
			this.sw = sw;
			this.hDC = hDC;
		}

		// Token: 0x17000001 RID: 1
		// (get) Token: 0x06000013 RID: 19 RVA: 0x0000268E File Offset: 0x0000088E
		public IntPtr HDC
		{
			get
			{
				return this.hDC;
			}
		}

		// Token: 0x06000014 RID: 20 RVA: 0x00002696 File Offset: 0x00000896
		public Graphics CreateGraphics()
		{
			return Graphics.FromHdc(this.hDC);
		}

		// Token: 0x06000015 RID: 21 RVA: 0x000026A3 File Offset: 0x000008A3
		public void Dispose()
		{
			if (this.hDC != IntPtr.Zero)
			{
				WindowDeviceContext.ReleaseDC(this.sw._hwnd, this.hDC);
				this.hDC = IntPtr.Zero;
			}
		}

		// Token: 0x06000016 RID: 22
		[DllImport("user32.dll")]
		private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);

		// Token: 0x0400006F RID: 111
		private IntPtr hDC;

		// Token: 0x04000070 RID: 112
		private SystemWindow sw;
	}
}
